#include<bits/stdc++.h>
using namespace std;
#define int long long
const int a[6] = {100, 50, 10, 5, 2, 1};
signed main()
{
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
//		vector<int> nums(n);
		int num = 0;
		int sum = 0;
		for (int i = 0; i < n; i++) {
			cin >> num;
			int index = 0;
			while (num != 0 && index < 6) {
				if (num >= a[index]) {
					sum += num / a[index];
					num %= a[index];
				}
				index++;
			}

		}
		cout << sum;
//		for(int i=0;i<0;i++){
//
//		}

	}
	return 0;
}
